import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:yqmssa_app/views/index/screen/message_manager.dart';
import 'package:yqmssa_app/widget/system_msg_widget.dart';

class SystemView extends StatelessWidget {
  const SystemView({super.key});

  @override
  Widget build(BuildContext context) {
    final manager = Get.find<MessageManager>();
    return Scaffold(
      appBar: AppBar(
        title: const Text('系统消息'),
        backgroundColor: Colors.white,
        surfaceTintColor: Colors.white,
        centerTitle: true,
        titleTextStyle: const TextStyle(fontSize: 18, color: Colors.black87),
        leading: IconButton(
          icon: const Icon(Icons.arrow_back_ios_new_rounded),
          onPressed: () => Navigator.of(context).pop(),
        ),
      ),
      backgroundColor: const Color(0XFFF5F5F5),
      body: ListView.builder(
        itemCount: manager.massageData.length,
        padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 12),
        itemBuilder: (context, index) {
          final data = manager.massageData[index];
          return Column(
            children: [
              if (index > 0) const SizedBox(height: 16),
              SystemMsgItem(data: data),
            ],
          );
        },
      ),
    );
  }
}
